import { useEffect, useState } from 'react'
import { fetchChannelAPI } from '@/apis/list'
import { ChannelItem } from '@/types/channel'

function useTabs() {
  const [channels, setChannels] = useState<ChannelItem[]>([])

  useEffect(() => {
    const getChannels = async () => {
      const res = await fetchChannelAPI()
      setChannels(res.data.data.channels)
    }
    getChannels()
  }, [])
  return { channels }
}

export { useTabs }